#import "NSBezierPath+SMRAdditions.h"


@implementation NSBezierPath (SMRAdditions)

-(void)smrFillWithInnerShadow:(NSShadow *)innerShadow {
	CGFloat radius = [innerShadow shadowBlurRadius];
	NSSize offset = [innerShadow shadowOffset];
	NSRect outerFrameRect = NSInsetRect([self bounds], -(fabs(offset.width) + radius), -(fabs(offset.height) + radius));
	NSBezierPath *outerFramePath = [NSBezierPath bezierPathWithRect:outerFrameRect];
	[outerFramePath appendBezierPath:self];
	[outerFramePath setWindingRule:NSEvenOddWindingRule];
	
	[NSGraphicsContext saveGraphicsState];
	[self addClip];
	[innerShadow set];
	[[NSColor blackColor] setFill];
	[outerFramePath fill];
	[NSGraphicsContext restoreGraphicsState];
}

@end
